import React from 'react';
import { Pagination } from 'antd';

const CurPagination = (props: any) => {
  const {
    pagination = { pageNum: 1, pageSize: 20 },
    total = 0,
    setPage = (pageNum: number, pageSize: number) => {},
    defaultPageSize = 20,
    pageSizeOptions = [10, 20, 50, 100],
  } = props;

  return (
    <Pagination
      showQuickJumper
      showSizeChanger
      current={pagination.pageNum}
      pageSize={pagination.pageSize}
      total={total}
      defaultPageSize={defaultPageSize}
      pageSizeOptions={pageSizeOptions}
      showTotal={(total) => {
        return (
          <>
            共<span className="pagination__total">{total}</span>条
          </>
        );
      }}
      onChange={setPage}
    />
  );
};

export default CurPagination;
